package com.sugar.ssm.controller;

import com.sugar.ssm.bean.Department;
import com.sugar.ssm.dto.Msg;
import com.sugar.ssm.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author tangyx
 * @date 2022/4/18 23:28
 * +
 */
@Controller
public class DepartmentController {

    @Autowired
    DepartmentService departmentService;

    @ResponseBody
    @RequestMapping("/depts")
    public Msg getDepts(){
        List<Department> list = departmentService.getList();
        return Msg.success().add("depts",list);
    }
}
